package net.cassite.dafstepbystep;

import net.cassite.daf4j.Data;
import net.cassite.daf4j.DataComparable;
import net.cassite.daf4j.DataUtils;
import net.cassite.daf4j.types.XInt;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 * Created by wkgcass on 15/11/2.
 */
@Entity
public class RP {
        public final DataComparable<Integer> id = new XInt(this);
        public final Data<Role> role = new Data<Role>(this);
        public final Data<Privilege> privilege = new Data<Privilege>(this);

        @Id
        @GeneratedValue
        public Integer getId() {
                return id.get();
        }

        public void setId(int id) {
                DataUtils.set(this.id, id);
        }

        @ManyToOne
        public Role getRole() {
                return role.get();
        }

        public void setRole(Role role) {
                DataUtils.set(this.role, role);
        }

        @ManyToOne
        public Privilege getPrivilege() {
                return privilege.get();
        }

        public void setPrivilege(Privilege privilege) {
                DataUtils.set(this.privilege, privilege);
        }
}
